<template>
  <div id="app">
    <button @click="goPayment">去支付</button>
  </div>
</template>

<script>
import axios from 'axios'
import qs from 'qs'
export default {
  methods: {
    goPayment () {
      const data = {
        orderId: 'a12345678'
      }
      axios({
        url: '/api/payment',
        method: 'post',
        headers: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        data: qs.stringify(data)
      }).then(res => {
        window.location.href = res.data.result
      })
    }
  }
}
</script>

<style>

</style>
